<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Diff</title>
</head>
<body>
<pre><code id="code" class="prettyprint"></code></pre>
<script language="javascript">
	document.getElementById("code").innerHTML = bitbeaker.getCode();

	String.prototype.startsWith = function(needle) { return(this.indexOf(needle) == 0); };
	var lines = document.getElementById("code").innerHTML.split(/\r?\n/);
	var colored = "";
	for (i=0; i<lines.length; i++) {
		var lines_modified = lines[i].match(/@@[ \-\+\d,]+@@/);
		if (lines_modified != null) {
			// range information (and optional section heading)
			colored += "<span style=\"background-color: #DEB887;\">" + lines_modified[0] + "</span>" +
				"<span style=\"background-color: #EED5B7;\">" + lines[i].substring(lines_modified[0].length) + "</span>\n";
		} else if (lines[i].startsWith("+")) {
			// added line
			colored += "<span style=\"background-color: #CCFFCC;\">" + lines[i] + "</span>\n";
		} else if (lines[i].startsWith("-")) {
			// deleted line
			colored += "<span style=\"background-color: #FFDDDD;\">" + lines[i] + "</span>\n";
		} else if (lines[i].startsWith(" ")) {
			// nothing changed
			colored += lines[i] + "\n";
		} else {
			// header information
			colored += "<span style=\"color: #A0A0A0;\">" + lines[i] + "</span>\n";
		}
	}
	document.getElementById("code").innerHTML = colored;

</script>
</body>
</html>